<?php 
defined('IN_SITE') or exit('Access Denied');


/*require_once MOD_ROOT.'html/html.class.php';
$html = new html();*/

require_once 'joke.class.php';
$joke = new joke();

switch($action)
{
	case 'category':
		
		break;
	
	case 'content':
	
		$data = $db->select("SELECT `jokeid`,`url` FROM `".DB_PRE."joke` ORDER BY `jokeid`");
		foreach($data as $r)
		{
			// 返回URL地址
			$showurl = $joke->url($r['jokeid']);
			if(!$db->get_one("SELECT jokeid FROM `".DB_PRE."joke` WHERE `jokeid`='$r[jokeid]' AND `url`='$showurl'"))
			{
				$db->query("UPDATE `".DB_PRE."joke` SET url='$showurl' WHERE `jokeid`='$r[jokeid]'");
			}
		}
		
		if($SETTING['ishtml'])
		{
			$message = "URL更新完成！开始更新内容页 ...";
			$forward = '?module=joke&file=html';
		}
		else
		{
			$message = "内容URL更新完成！";
			$forward = '?module=joke';
		}
		showmessage($message, $forward);
		break;
	
	default:
		include 'templates/url.tpl.php';
} 
 
 
?>